<?php if(isset($_SESSION['user']['user_id']) && $_SESSION['user']['user_id']!=""){?>
<div class="col-md-8">
	<div class="main-content" id="main-content">
		<div class="sub-content">	
			<div class="top-header page-header clearfix">
				<h1>Comment</h1>
			</div>
			<div class="user-profile1 col-md-12">
				<form id="commentForm" name="commentForm"  method="post" class="form-horizontal" role="form">
					<div class="form-group">
						<label class="control-label col-sm-3">Comment</label>
						<div class="col-sm-9">
						<textarea  class="profile_add form-control" id="comment" name="comment" placeholder="Type comments" ></textarea></div>
					</div><div class="clearfix"></div><span id="commenterror" style="margin-left:70px;color:red"><span>
					<div class="adding_list form-group">
						<div class="botton_btns">
							<div class="col-sm-3">&nbsp;</div>
							<div class="col-sm-9">
								<a href="javascript:void(0);" onclick="return addComments();" class="btn btn-danger" role="button">Submit</a>						
							</div>
						</div>
					</div>						
				</form>	
			</div>
		</div>	
	</div>
</div><div class="clearfix"></div>
<!--End-->
<script>
	function addComments(){	
		var flag=true;
		var comments=$("#comment").val();	
		if(comments==""){
			alert('Comment is required');
			flag=false;
			$("#comment").focus();
		}	
		if(flag==false){ 
				return false;
		}else{
			$("#commentForm").submit();
		}		
	}	
	$(function(){
		<? if(isset($_GET['success']) && $_GET['success']!=""){?>
			alert("Your comment has been sent successfully.");
			window.location=BASE_URL+'/profiles/comment';		
		<?}?>
	});
</script>
<?php } else {?>
	<script>
		window.location='<? echo $this->Url('home')?>';
	</script>
<?}?>